﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="CenterStandardUsage.aspx.cs" Inherits="Charts_Bar_CenterStandardUsage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
    <script lang="jv" type="text/javascript">
        function SelectItem(sender, e) {
            e.IsValid = (e.Value != '0');
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="Server">
       <section class="featured">
        <div class="content-wrapper" dir="rtl">
            مقایسه میزان مصرف و استاندارد مرکز
        </div>
    </section>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="Server">
    <div dir="rtl" style="width: 100%;">
        <asp:Label ID="CenterNameLabel" runat="server" Text="نام مرکز:" SkinID="Caption" CssClass="lable"></asp:Label>
        <asp:DropDownList ID="CenterDropDownList" runat="server" SkinID="FormDropDownList"
            DataSourceID="CenterEntityDataSource" DataTextField="Name" DataValueField="ID">
        </asp:DropDownList>
        
        <asp:Label ID="TypeLabel" runat="server" Text="نوع انرژی:" SkinID="Caption" CssClass="lable"></asp:Label>
        <asp:DropDownList ID="TypeDropDownList" runat="server" SkinID="FormDropDownList" DataSourceID="ConstantEntityDataSource"
            DataTextField="ConstantName" DataValueField="ConstantValue">
        </asp:DropDownList>
        <asp:CustomValidator ID="TypeCustomValidator" runat="server" ClientValidationFunction="SelectItem"
            ControlToValidate="TypeDropDownList" Display="Dynamic" ErrorMessage="*" ValidateEmptyText="True"></asp:CustomValidator>
        <br />
        <asp:Label ID="DateLabel" runat="server" Text="تاریخ:" SkinID="Caption" CssClass="lable"></asp:Label>
        <pdc:PersianDateTextBox ID="DatePersianDateTextBox" runat="server" PickerDirection="ToRight" ShowPickerOnTop="True"></pdc:PersianDateTextBox>
        <asp:RequiredFieldValidator ID="PersianDateRequiredFieldValidator" runat="server" ControlToValidate="DatePersianDateTextBox"
            Display="Dynamic" ErrorMessage="*"></asp:RequiredFieldValidator>
        <br />
        <asp:LinkButton ID="ChartLinkButton" runat="server" OnClick="ChartLinkButton_Click" Text="گزارش" CssClass="button" />
        <br />
    </div>
    <br />
<div style="float: right; width: 90%;vertical-align:top;" dir="rtl" class="gvclass">
        <asp:Chart ID="CenterStandardUsageChart" runat="server" DataSourceID="CenterStandardUsageSqlDataSource" Height="500px" Width="700px">
            <Series>
            </Series>
            <ChartAreas>
                <asp:ChartArea Name="ChartArea1">
                </asp:ChartArea>
            </ChartAreas>
            <Titles>
                <asp:Title Name="Title1" Text="نمودار مصرف مراکز">
                </asp:Title>
            </Titles>
        </asp:Chart>
    </div>
    <asp:SqlDataSource ID="CenterStandardUsageSqlDataSource" runat="server" ConnectionString='<%$ ConnectionStrings:ICTBillingConnectionString %>' SelectCommand="spCenterStandardUsage" SelectCommandType="StoredProcedure">
        <SelectParameters>
            <asp:ControlParameter ControlID="CenterDropDownList" PropertyName="SelectedValue" Name="CenterID" Type="Int32"></asp:ControlParameter>
            <asp:ControlParameter ControlID="DatePersianDateTextBox" PropertyName="DateValue" Name="Date" Type="DateTime"></asp:ControlParameter>                        
            <asp:ControlParameter ControlID="TypeDropDownList" PropertyName="SelectedValue" Name="Type" Type="Byte"></asp:ControlParameter>
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:EntityDataSource ID="CenterEntityDataSource" runat="server" ConnectionString="name=ICTBillingEntities" DefaultContainerName="ICTBillingEntities"
        EnableFlattening="False"
        CommandText="(SELECT  it.[PkCenterID] As ID, it.[CenterName] As Name FROM ICTBillingEntities.tbCenters AS it) UNION (SELECT x.[ConstantValue] as ID,x.[ConstantName] As Name from ICTBillingEntities.tbConstants as x where x.PkConstantID=2)">
    </asp:EntityDataSource>
    <asp:EntityDataSource ID="ConstantEntityDataSource" runat="server" ConnectionString="name=ICTBillingEntities" DefaultContainerName="ICTBillingEntities"
        EnableFlattening="False"
        CommandText="(SELECT x.[ConstantValue],x.[ConstantName]  from ICTBillingEntities.tbConstants as x where (x.[PkConstantID] = 2 || x.[FatherID] = 3))"
        EntityTypeFilter="" Select="">
    </asp:EntityDataSource>
    <pdc:PersianDateScriptManager ID="PersianDateScriptManager" runat="server">
    </pdc:PersianDateScriptManager>
</asp:Content>

